<template>
  <div>
    user login<br><br>
    <input type="text" v-model="userName"/><br><br>
    <input type="password" v-model="userPass"/><br><br>
    <button @click="login">LOGIN</button>
  </div>
</template>
<script>
// import axios from 'axios';
export default{
  data(){
    return {
      userName:'youqd',
      userPass:'123456'
    }
  },
  methods:{
    login(){
      // this.$router.push("/main");
      let that = this
      this.$http.get('https://api.coindesk.com/v1/bpi/currentprice.json')
      .then(function (response) {
        console.info(response.data)
        // that.$router.push("/main");
        that.$store.commit('setName','游庆党')
        that.$router.push({path:'/main',query:{name:'youqd'}})
        
      })
      .catch(function (error) {
        console.log(error);
      });
    }
  }
}
</script>
